{{define "demo01/index.html"}}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/s/js/jquery-3.7.1.min.js"></script>
</head>
<body>
    开始访问的界面
    <form action="/submitUser" method="post">
        用户名：<input type="text" name = "userName" id="username"> <span id = "msgdata"></span><br>

        密码：<input type="password" name="pwd"  id="pwd"><br>
        <input type="submit" value="提交">
    </form>


    <script>
        usernameText = document.getElementById("username")
        usernameText.onblur = function (){
            uname = usernameText.value;
            //alert(uname)
            $.ajax(
                {
                    url : "/ajaxpost",
                    type: "POST",
                    data:{
                        "uname" :uname,
                    },

                    success : function(info){
                        document.getElementById("msgdata").innerText =info["msg"]
                    },

                    fail :function (){      //响应失败后处理逻辑

                    }
                }

            )
        }
    </script>
</body>
</html>
{{end}}